﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Configuration;


namespace L2C.Controllers
{
    public class DealController : Controller
    {
        L2CEntities entities = new L2CEntities(ConfigurationManager.ConnectionStrings["L2CEntities"].ToString());
        public ActionResult Item(int? itemId, string caption = "")
        {
            var data = entities.Publishing_Item.Where(x => x.Item_Id == itemId).Select(x => new L2C.Models.DealDetailModel { ID = x.Item_Id, Title = x.Title, Description = x.Descriptions, SellPrice = x.SellPrice, Content = x.MainContent, Highlight = x.Highlight, Image = x.Image, ShortTitle = x.ShortTitle, ProductPrice = x.Product_Price, DiscountPercent = x.DiscountPercent, ViewerCounter = x.ViewerCounter }).SingleOrDefault();
            return View(data);
        }

        public ActionResult Index()
        {
            return RedirectToRoute("Default");
        }

    }
}
